home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
filarry.exe
/
README.1ST
< prev
next >
Wrap
Text File
|
1993-04-16
|
3KB
|
66 lines
XF2SF.exe -- convert your normal text string file to
"string data table file" (extension name .SDT)
FILARRAY.H -- header file of class FileArray
FILARRAY.CPP -- class FileArray implenmentation
The dilemma was posed by Richard Wesson(76701,46) is the following:
" 'I have a very large program which I must compile in the LARGE model,
because I have to link large model libraries, yet I am getting DGROUP
EXCEEDS 64K error messages, because I have so many literal strings.
What can I do?' "
The possible solutions are either place literal strings into far string
variable or place literal strings into a text file. However, either
solution has its own drawback.
First, if we put into literal string into far string variable, it will
take mem without doubt. As we know mem is always a precious computer
resource no matter what kind of environment, so putting literal strings
into mem seems to be unwise. Second, if we put literal strings into
a normal text file, we encounter a speed problem. How can we quickly
retrieve any arbitrary string from a file?
xf2sf.exe and class FileArray may be the solution.
*.sdt file format:
______________________________
| |
| HeadArea | head len = sizeof(SDTHEADER)
| |
|____________________________|
| |
| |
| String Context Area |
| |
| |
| |
| |
|____________________________|
| |
| |
| Offset Array Area |
| (String Index Area) | offset array area len
| | = offsetArraySize * sizeof(long)
| | = num of string * sizeof(long)
| |
|____________________________|
the procedure is this:
1. put your literal string into a normal text file.
2. use xf2sf.exe convert your file to *.sdt file
3. in your source code you can use FileArray like this:
// instanciate an object of class FileArray first
FileArray myfobj("mytest.sdt");
...
// before some function may look like
abcFunc("this is test...", ...);
...
// now the function may look like
abcFunc(myfobj[10], ...);
( here as an example I assume the string "this is test..." is 10th
string corresponding to your text file )
If you have any question send me CompuServe mail at 71162,1646 (Jian Hua)